Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Optimization to v4, and related packages accordingly #2354

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

penelopeysm
Copy link
Member

@penelopeysm penelopeysm commented Sep 27, 2024

Re-opening #2327.

Closes #2348

Closes #2349

Closes #2350

Closes #2351

Closes #2352

Closes #2353

@penelopeysm
Copy link
Member Author

penelopeysm commented Sep 27, 2024

Failing test MWE

using Random
using Turing
import ReverseDiff

@model function f()
    x ~ Normal(0, 1)
end

Random.seed!(222)

# cons_args is mandatory, if no constraints are passed it runs fine
cons(res, x, _) = (res .= [x[1]])
cons_args = (cons=cons, lcons=[0], ucons=[Inf])
initial_params = [0.5]

m1 = Turing.Optimisation.estimate_mode(
    f(), MAP(); initial_params=initial_params, cons_args...
)
Show the error traceback
ERROR: MethodError: promote_rule(::Type{IrrationalConstants.Log2π}, ::Type{ForwardDiff.Dual{ForwardDiff.Tag{DifferentiationInterfaceForwardDiffExt.ForwardDiffOverSomethingHVPWrapper{OptimizationBase.var"#_f#22"{SciMLBase.OptimizationFunction{true, AutoForwardDiff{nothing, Nothing}, LogDensityFunction{DynamicPPL.TypedVarInfo{@NamedTuple{x::DynamicPPL.Metadata{Dict{AbstractPPL.VarName{:x, typeof(identity)}, Int64}, Vector{Normal{Float64}}, Vector{AbstractPPL.VarName{:x, typeof(identity)}}, Vector{Float64}, Vector{Set{DynamicPPL.Selector}}}}, Float64}, DynamicPPL.Model{typeof(f), (), (), (), Tuple{}, Tuple{}, DynamicPPL.DefaultContext}, Turing.Optimisation.OptimizationContext{DynamicPPL.DefaultContext}}, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(cons), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}}}, Float64}, Float64, 1}}) is ambiguous.

Candidates:
  promote_rule(::Type{S}, ::Type{T}) where {S<:AbstractIrrational, T<:Number}
    @ Base irrationals.jl:45
  promote_rule(::Type{<:AbstractIrrational}, ::Type{T}) where T<:Real
    @ Base irrationals.jl:44
  promote_rule(::Type{R}, ::Type{ForwardDiff.Dual{T, V, N}}) where {R<:Real, T, V, N}
    @ ForwardDiff ~/.julia/packages/ForwardDiff/PcZ48/src/dual.jl:427

Possible fix, define
  promote_rule(::Type{R}, ::Type{ForwardDiff.Dual{T, V, N}}) where {R<:AbstractIrrational, T, V, N}

Stacktrace:
  [1] promote_type(::Type{IrrationalConstants.Log2π}, ::Type{ForwardDiff.Dual{ForwardDiff.Tag{…}, Float64, 1}})
    @ Base ./promotion.jl:313
  [2] promote_type(::Type, ::Type, ::Type)
    @ Base ./promotion.jl:299
  [3] ForwardOptimize
    @ ~/.julia/packages/ReverseDiff/p1MzG/src/macros.jl:122 [inlined]
  [4] +
    @ ~/.julia/packages/ReverseDiff/p1MzG/src/derivatives/scalars.jl:17 [inlined]
  [5] normlogpdf(z::ReverseDiff.TrackedReal{ForwardDiff.Dual{…}, ForwardDiff.Dual{…}, Nothing})
    @ StatsFuns ~/.julia/packages/StatsFuns/NSRpu/src/distrs/norm.jl:29
  [6] normlogpdf(μ::Float64, σ::Float64, x::ReverseDiff.TrackedReal{…})
    @ StatsFuns ~/.julia/packages/StatsFuns/NSRpu/src/distrs/norm.jl:41
  [7] logpdf(d::Normal{…}, x::ReverseDiff.TrackedReal{…})
    @ Distributions ~/.julia/packages/Distributions/uuqsE/src/univariates.jl:645
  [8] tilde_assume(ctx::Turing.Optimisation.OptimizationContext{…}, dist::Normal{…}, vn::AbstractPPL.VarName{…}, vi::DynamicPPL.TypedVarInfo{…})
    @ Turing.Optimisation ~/ppl/lib/src/optimisation/Optimisation.jl:71
  [9] tilde_assume!!(context::Turing.Optimisation.OptimizationContext{…}, right::Normal{…}, vn::AbstractPPL.VarName{…}, vi::DynamicPPL.TypedVarInfo{…})
    @ DynamicPPL ~/.julia/packages/DynamicPPL/DvdZw/src/context_implementations.jl:144
 [10] macro expansion
    @ ~/.julia/packages/DynamicPPL/DvdZw/src/compiler.jl:579 [inlined]
 [11] f(__model__::DynamicPPL.Model{…}, __varinfo__::DynamicPPL.TypedVarInfo{…}, __context__::Turing.Optimisation.OptimizationContext{…})
    @ Main ./REPL[13]:1
 [12] _evaluate!!(model::DynamicPPL.Model{…}, varinfo::DynamicPPL.TypedVarInfo{…}, context::Turing.Optimisation.OptimizationContext{…})
    @ DynamicPPL ~/.julia/packages/DynamicPPL/DvdZw/src/model.jl:973
 [13] evaluate_threadunsafe!!(model::DynamicPPL.Model{…}, varinfo::DynamicPPL.TypedVarInfo{…}, context::Turing.Optimisation.OptimizationContext{…})
    @ DynamicPPL ~/.julia/packages/DynamicPPL/DvdZw/src/model.jl:946
 [14] evaluate!!(model::DynamicPPL.Model{…}, varinfo::DynamicPPL.TypedVarInfo{…}, context::Turing.Optimisation.OptimizationContext{…})
    @ DynamicPPL ~/.julia/packages/DynamicPPL/DvdZw/src/model.jl:894
 [15] (::LogDensityFunction{…})(z::ReverseDiff.TrackedArray{…})
    @ Turing.Optimisation ~/ppl/lib/src/optimisation/Optimisation.jl:145
 [16] (::LogDensityFunction{…})(z::ReverseDiff.TrackedArray{…}, ::SciMLBase.NullParameters)
    @ Turing.Optimisation ~/ppl/lib/src/optimisation/Optimisation.jl:150
 [17] (::SciMLBase.OptimizationFunction{…})(::ReverseDiff.TrackedArray{…}, ::Vararg{…})
    @ SciMLBase ~/.julia/packages/SciMLBase/DXnzJ/src/scimlfunctions.jl:3812
 [18] (::OptimizationBase.var"#_f#22"{…})(θ::ReverseDiff.TrackedArray{…})
    @ OptimizationBase ~/.julia/packages/OptimizationBase/3r1wm/src/OptimizationDIExt.jl:36
 [19] ReverseDiff.GradientTape(f::OptimizationBase.var"#_f#22"{…}, input::Vector{…}, cfg::ReverseDiff.GradientConfig{…})
    @ ReverseDiff ~/.julia/packages/ReverseDiff/p1MzG/src/api/tape.jl:199
 [20] ReverseDiff.GradientTape(f::Function, input::Vector{ForwardDiff.Dual{ForwardDiff.Tag{…}, Float64, 1}})
    @ ReverseDiff ~/.julia/packages/ReverseDiff/p1MzG/src/api/tape.jl:198
 [21] prepare_gradient(f::Function, ::AutoReverseDiff{false}, x::Vector{ForwardDiff.Dual{ForwardDiff.Tag{…}, Float64, 1}})
    @ DifferentiationInterfaceReverseDiffExt ~/.julia/packages/DifferentiationInterface/FTGtS/ext/DifferentiationInterfaceReverseDiffExt/onearg.jl:53
 [22] prepare_hvp(f::OptimizationBase.var"#_f#22"{…}, backend::DifferentiationInterface.SecondOrder{…}, x::Vector{…}, tx::DifferentiationInterface.Tangents{…})
    @ DifferentiationInterfaceForwardDiffExt ~/.julia/packages/DifferentiationInterface/FTGtS/ext/DifferentiationInterfaceForwardDiffExt/secondorder.jl:35
 [23] prepare_hessian(f::OptimizationBase.var"#_f#22"{…}, backend::DifferentiationInterface.SecondOrder{…}, x::Vector{…})
    @ DifferentiationInterface ~/.julia/packages/DifferentiationInterface/FTGtS/src/second_order/hessian.jl:68
 [24] instantiate_function(f::SciMLBase.OptimizationFunction{…}, x::Vector{…}, adtype::AutoForwardDiff{…}, p::SciMLBase.NullParameters, num_cons::Int64; g::Bool, h::Bool, hv::Bool, fg::Bool, fgh::Bool, cons_j::Bool, cons_vjp::Bool, cons_jvp::Bool, cons_h::Bool, lag_h::Bool)
    @ OptimizationBase ~/.julia/packages/OptimizationBase/3r1wm/src/OptimizationDIExt.jl:82
 [25] instantiate_function
    @ ~/.julia/packages/OptimizationBase/3r1wm/src/OptimizationDIExt.jl:28 [inlined]
 [26] #instantiate_function#48
    @ ~/.julia/packages/OptimizationBase/3r1wm/src/OptimizationDIExt.jl:294 [inlined]
 [27] instantiate_function
    @ ~/.julia/packages/OptimizationBase/3r1wm/src/OptimizationDIExt.jl:287 [inlined]
 [28] OptimizationBase.OptimizationCache(prob::SciMLBase.OptimizationProblem{…}, opt::Optim.IPNewton{…}; callback::Function, maxiters::Nothing, maxtime::Nothing, abstol::Nothing, reltol::Nothing, progress::Bool, structural_analysis::Bool, manifold::Nothing, kwargs::@Kwargs{})
    @ OptimizationBase ~/.julia/packages/OptimizationBase/3r1wm/src/cache.jl:37
 [29] OptimizationCache
    @ ~/.julia/packages/OptimizationBase/3r1wm/src/cache.jl:25 [inlined]
 [30] #__init#2
    @ ~/.julia/packages/OptimizationOptimJL/BIkTp/src/OptimizationOptimJL.jl:109 [inlined]
 [31] __init
    @ ~/.julia/packages/OptimizationOptimJL/BIkTp/src/OptimizationOptimJL.jl:80 [inlined]
 [32] #init#657
    @ ~/.julia/packages/SciMLBase/DXnzJ/src/solve.jl:174 [inlined]
 [33] init
    @ ~/.julia/packages/SciMLBase/DXnzJ/src/solve.jl:172 [inlined]
 [34] solve(::SciMLBase.OptimizationProblem{…}, ::Optim.IPNewton{…}; kwargs::@Kwargs{})
    @ SciMLBase ~/.julia/packages/SciMLBase/DXnzJ/src/solve.jl:96
 [35] solve(::SciMLBase.OptimizationProblem{…}, ::Optim.IPNewton{…})
    @ SciMLBase ~/.julia/packages/SciMLBase/DXnzJ/src/solve.jl:93
 [36] estimate_mode(model::DynamicPPL.Model{…}, estimator::MAP, solver::Nothing; initial_params::Vector{…}, adtype::AutoForwardDiff{…}, cons::Function, lcons::Vector{…}, ucons::Vector{…}, lb::Nothing, ub::Nothing, kwargs::@Kwargs{})
    @ Turing.Optimisation ~/ppl/lib/src/optimisation/Optimisation.jl:499
 [37] estimate_mode
    @ ~/ppl/lib/src/optimisation/Optimisation.jl:456 [inlined]
 [38] top-level scope
    @ REPL[18]:1
Some type information was truncated. Use `show(err)` to see complete types.
Output of ]st --manifest
(ppl) pkg> st --manifest
Status `~/ppl/Manifest.toml`
  [47edcb42] ADTypes v1.9.0
  [621f4979] AbstractFFTs v1.5.0
  [80f14c24] AbstractMCMC v5.3.0
  [7a57a42e] AbstractPPL v0.8.4
  [1520ce14] AbstractTrees v0.4.5
  [7d9f7c33] Accessors v0.1.38
  [79e6a3ab] Adapt v4.0.4
  [0bf59076] AdvancedHMC v0.6.1
  [5b7e9947] AdvancedMH v0.8.3
  [576499cb] AdvancedPS v0.6.0
  [b5ca4192] AdvancedVI v0.2.6
  [66dad0bd] AliasTables v1.1.3
  [dce04be8] ArgCheck v2.3.0
  [ec485272] ArnoldiMethod v0.4.0
  [4fba245c] ArrayInterface v7.16.0
  [a9b6321e] Atomix v0.1.0
  [13072b0f] AxisAlgorithms v1.1.0
  [39de3d68] AxisArrays v0.4.7
  [198e06fe] BangBang v0.4.3
  [9718e550] Baselet v0.1.1
  [e2ed5e7c] Bijections v0.1.9
  [76274a88] Bijectors v0.13.18
  [fa961155] CEnum v0.5.0
  [082447d4] ChainRules v1.71.0
  [d360d2e6] ChainRulesCore v1.25.0
  [9e997f8a] ChangesOfVariables v0.1.9
  [861a8166] Combinatorics v1.0.2
  [38540f10] CommonSolve v0.2.4
  [bbf7d656] CommonSubexpressions v0.3.1
  [f70d9fcc] CommonWorldInvalidations v1.0.0
  [34da2185] Compat v4.16.0
  [b152e2b5] CompositeTypes v0.1.4
  [a33af91c] CompositionsBase v0.1.2
  [88cd18e8] ConsoleProgressMonitor v0.1.2
  [187b0558] ConstructionBase v1.5.8
  [6add18c4] ContextVariablesX v0.1.3
  [a8cc5b0e] Crayons v4.1.1
  [717857b8] DSP v0.7.10
  [9a962f9c] DataAPI v1.16.0
  [864edb3b] DataStructures v0.18.20
  [e2d170a0] DataValueInterfaces v1.0.0
  [244e2a9f] DefineSingletons v0.1.2
  [8bb1440f] DelimitedFiles v1.9.1
  [b429d917] DensityInterface v0.4.0
  [85a47980] Dictionaries v0.4.2
  [163ba53b] DiffResults v1.1.0
  [b552c78f] DiffRules v1.15.1
⌅ [a0c0ee7d] DifferentiationInterface v0.5.17
  [31c24e10] Distributions v0.25.112
  [ced4e74d] DistributionsAD v0.6.55
  [ffbed154] DocStringExtensions v0.9.3
  [5b8099bc] DomainSets v0.7.14
⌅ [366bfd00] DynamicPPL v0.28.4
  [7c1d4256] DynamicPolynomials v0.6.0
  [b7d42ee7] Einsum v0.4.1
  [cad2338a] EllipticalSliceSampling v2.0.0
  [4e289a0a] EnumX v1.0.4
  [e2ba6199] ExprTools v0.1.10
⌅ [6b7a57c9] Expronicon v0.8.5
  [7a1cc6ca] FFTW v1.8.0
  [cc61a311] FLoops v0.2.2
  [b9860ae5] FLoopsBase v0.1.1
  [9aa1b823] FastClosures v0.3.2
  [1a297f60] FillArrays v1.13.0
  [6a86dc24] FiniteDiff v2.24.0
  [1fa38f19] Format v1.3.7
  [f6369f11] ForwardDiff v0.10.36
  [069b7b12] FunctionWrappers v1.1.3
  [77dc65aa] FunctionWrappersWrappers v0.1.3
  [d9f16b24] Functors v0.4.12
  [46192b85] GPUArraysCore v0.1.6
  [86223c79] Graphs v1.11.2
  [1baab800] HybridArrays v0.4.16
  [34004b35] HypergeometricFunctions v0.3.24
  [615f187c] IfElse v0.1.1
  [313cdc1a] Indexing v1.1.1
  [d25df0c9] Inflate v0.1.5
  [22cec73e] InitialValues v0.3.1
  [505f98c9] InplaceOps v0.3.0
  [18e54dd8] IntegerMathUtils v0.1.2
  [a98d9a8b] Interpolations v0.15.1
  [8197267c] IntervalSets v0.7.10
  [3587e190] InverseFunctions v0.1.17
  [41ab1584] InvertedIndices v1.3.0
  [92d709cd] IrrationalConstants v0.2.2
  [c8e1da08] IterTools v1.10.0
  [82899510] IteratorInterfaceExtensions v1.0.0
  [692b3bcd] JLLWrappers v1.6.0
  [b14d175d] JuliaVariables v0.2.4
  [63c18a36] KernelAbstractions v0.9.27
  [5ab0869b] KernelDensity v0.6.9
  [2c470bb0] Kronecker v0.5.5
  [5be7bae1] LBFGSB v0.4.1
  [929cbde3] LLVM v9.1.2
  [8ac3fa9e] LRUCache v1.6.1
  [b964fa9f] LaTeXStrings v1.3.1
  [984bce1d] LambertW v0.4.6
  [23fbe1c1] Latexify v0.16.5
  [1d6d02ad] LeftChildRightSiblingTrees v0.2.0
  [6f1fad26] Libtask v0.8.7
  [d3d80556] LineSearches v7.3.0
  [7a12625a] LinearMaps v3.11.3
  [6fdf6af0] LogDensityProblems v2.1.1
  [996a588d] LogDensityProblemsAD v1.10.1
  [2ab3a3ac] LogExpFunctions v0.3.28
  [e6f89c97] LoggingExtras v1.0.3
  [c7f686f2] MCMCChains v6.0.6
  [be115224] MCMCDiagnosticTools v0.3.10
  [e80e1ace] MLJModelInterface v1.11.0
  [d8e11817] MLStyle v0.4.17
  [f1d291b0] MLUtils v0.4.4
  [1914dd2f] MacroTools v0.5.13
  [af67fdf4] ManifoldDiff v0.3.12
⌅ [1cead3c2] Manifolds v0.9.20
  [3362f125] ManifoldsBase v0.15.16
  [dbb5928d] MappedArrays v0.4.2
  [99c1a7ee] MatrixEquations v2.4.2
  [128add7d] MicroCollections v0.2.0
  [e1d29d7a] Missings v1.2.0
  [102ac46a] MultivariatePolynomials v0.5.6
  [d8a4904e] MutableArithmetics v1.5.0
  [d41bc354] NLSolversBase v7.8.3
  [872c559c] NNlib v0.9.24
  [77ba4419] NaNMath v1.0.2
  [71a1bf82] NameResolution v0.1.5
  [86f7a689] NamedArrays v0.10.3
  [356022a1] NamedDims v1.2.2
  [c020b1a1] NaturalSort v1.0.0
  [6fe1bfb0] OffsetArrays v1.14.1
  [429524aa] Optim v1.9.4
  [3bd65402] Optimisers v0.3.3
  [7f7a1694] Optimization v4.0.2
  [bca83a33] OptimizationBase v2.0.4
  [36348300] OptimizationOptimJL v0.4.0
  [bac558e1] OrderedCollections v1.6.3
  [90014a1f] PDMats v0.11.31
  [65ce6f38] PackageExtensionCompat v1.0.2
  [d96e819e] Parameters v0.12.3
  [f27b6e38] Polynomials v4.0.11
  [85a6dd25] PositiveFactorizations v0.2.4
  [aea7be01] PrecompileTools v1.2.1
  [21216c6a] Preferences v1.4.3
  [8162dcfd] PrettyPrint v0.2.0
  [08abe8d2] PrettyTables v2.4.0
  [27ebfcd6] Primes v0.5.6
  [33c8b6b6] ProgressLogging v0.1.4
  [92933f4c] ProgressMeter v1.10.2
  [43287f4e] PtrArrays v1.2.1
  [1fd47b50] QuadGK v2.11.1
  [94ee1d12] Quaternions v0.7.6
  [74087812] Random123 v1.7.0
  [e6cf234a] RandomNumbers v1.6.0
  [b3c3ace0] RangeArrays v0.3.2
  [c84ed2f1] Ratios v0.4.5
  [c1ae055f] RealDot v0.1.0
  [3cdcf5f2] RecipesBase v1.3.4
  [731186ca] RecursiveArrayTools v3.27.0
  [189a3867] Reexport v1.2.2
  [ae029012] Requires v1.3.0
  [37e2e3b7] ReverseDiff v1.15.3
  [79098fc4] Rmath v0.8.0
  [f2b01f46] Roots v2.2.1
  [7e49a35a] RuntimeGeneratedFunctions v0.5.13
⌅ [26aad666] SSMProblems v0.1.1
  [0bca4576] SciMLBase v2.54.0
  [c0aeaf25] SciMLOperators v0.3.10
  [53ae85a6] SciMLStructures v1.5.0
  [30f210dd] ScientificTypesBase v3.0.0
  [efcf1570] Setfield v1.1.1
  [605ecd9f] ShowCases v0.1.0
  [699a6c99] SimpleTraits v0.9.4
  [ce78b400] SimpleUnPack v1.1.0
  [47aef6b3] SimpleWeightedGraphs v1.4.0
  [a2af1166] SortingAlgorithms v1.2.1
  [9f842d2f] SparseConnectivityTracer v0.6.5
  [dc90abb0] SparseInverseSubset v0.1.2
  [0a514795] SparseMatrixColorings v0.4.1
  [276daf66] SpecialFunctions v2.4.0
  [171d559e] SplittablesBase v0.1.15
  [90137ffa] StaticArrays v1.9.7
  [1e83bf80] StaticArraysCore v1.4.3
  [64bff920] StatisticalTraits v3.4.0
  [82ae8749] StatsAPI v1.7.0
  [2913bbd2] StatsBase v0.34.3
  [4c63d2b9] StatsFuns v1.3.2
  [892a3eda] StringManipulation v0.4.0
  [09ab397b] StructArrays v0.6.18
  [4297ee4d] SymbolicAnalysis v0.3.0
  [2efcf032] SymbolicIndexingInterface v0.3.31
  [19f23fe9] SymbolicLimits v0.2.2
  [d1185830] SymbolicUtils v3.7.1
  [0c5d862f] Symbolics v6.13.0
  [3783bdb8] TableTraits v1.0.1
  [bd369af6] Tables v1.12.0
  [8ea1fca8] TermInterface v2.0.0
  [5d786b92] TerminalLoggers v0.1.7
  [a759f4b9] TimerOutputs v0.5.24
  [9f7883ad] Tracker v0.2.35
  [28d57a85] Transducers v0.4.82
  [fce5fe82] Turing v0.34.1 `lib`
  [3a884ed6] UnPack v1.0.2
  [a7c27f48] Unityper v0.1.6
  [013be700] UnsafeAtomics v0.2.1
  [d80eeb9a] UnsafeAtomicsLLVM v0.2.1
  [efce3f68] WoodburyMatrices v1.0.0
  [700de1a5] ZygoteRules v0.2.5
  [f5851436] FFTW_jll v3.3.10+1
  [1d5cc7b8] IntelOpenMP_jll v2024.2.1+0
  [dad2f222] LLVMExtra_jll v0.0.34+0
  [81d17ec3] L_BFGS_B_jll v3.0.1+0
  [856f044c] MKL_jll v2024.2.0+0
  [efe28fd5] OpenSpecFun_jll v0.5.5+0
  [f50d1b31] Rmath_jll v0.5.1+0
  [1317d2d5] oneTBB_jll v2021.12.0+0
  [0dad84c5] ArgTools v1.1.1
  [56f22d72] Artifacts
  [2a0f44e3] Base64
  [ade2ca70] Dates
  [8ba89e20] Distributed
  [f43a241f] Downloads v1.6.0
  [7b1f6079] FileWatching
  [9fa8497b] Future
  [b77e0a4c] InteractiveUtils
  [4af54fe1] LazyArtifacts
  [b27032c2] LibCURL v0.6.4
  [76f85450] LibGit2
  [8f399da3] Libdl
  [37e2e46d] LinearAlgebra
  [56ddb016] Logging
  [d6f4376e] Markdown
  [a63ad114] Mmap
  [ca575930] NetworkOptions v1.2.0
  [44cfe95a] Pkg v1.10.0
  [de0858da] Printf
  [3fa0cd96] REPL
  [9a3f8284] Random
  [ea8e919c] SHA v0.7.0
  [9e88b42a] Serialization
  [1a1011a3] SharedArrays
  [6462fe0b] Sockets
  [2f01184e] SparseArrays v1.10.0
  [10745b16] Statistics v1.10.0
  [4607b0f0] SuiteSparse
  [fa267f1f] TOML v1.0.3
  [a4e569a6] Tar v1.10.0
  [8dfed614] Test
  [cf7118a7] UUIDs
  [4ec0a83e] Unicode
  [e66e0078] CompilerSupportLibraries_jll v1.1.1+0
  [deac9b47] LibCURL_jll v8.4.0+0
  [e37daf67] LibGit2_jll v1.6.4+0
  [29816b5a] LibSSH2_jll v1.11.0+1
  [c8ffd9c3] MbedTLS_jll v2.28.2+1
  [14a3606d] MozillaCACerts_jll v2023.1.10
  [4536629a] OpenBLAS_jll v0.3.23+4
  [05823500] OpenLibm_jll v0.8.1+2
  [bea87d4a] SuiteSparse_jll v7.2.1+1
  [83775a58] Zlib_jll v1.2.13+1
  [8e850b90] libblastrampoline_jll v5.11.0+0
  [8e850ede] nghttp2_jll v1.52.0+1
  [3f19e933] p7zip_jll v17.4.0+2
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated -m`
versioninfo()
julia> versioninfo()
Julia Version 1.10.5
Commit 6f3fdf7b362 (2024-08-27 14:19 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 10 × Apple M1 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)

@penelopeysm penelopeysm marked this pull request as draft September 27, 2024 15:22
@penelopeysm penelopeysm reopened this Sep 27, 2024
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.26%. Comparing base (f388e61) to head (850548d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2354      +/-   ##
==========================================
- Coverage   86.39%   86.26%   -0.13%     
==========================================
  Files          22       22              
  Lines        1573     1573              
==========================================
- Hits         1359     1357       -2     
- Misses        214      216       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Sep 27, 2024

Pull Request Test Coverage Report for Build 11073388637

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 460 unchanged lines in 13 files lost coverage.
  • Overall coverage decreased (-29.3%) to 57.758%

Files with Coverage Reduction New Missed Lines %
src/mcmc/emcee.jl 2 90.2%
src/variational/VariationalInference.jl 4 14.29%
src/mcmc/gibbs.jl 4 94.05%
src/mcmc/particle_mcmc.jl 10 87.84%
src/mcmc/gibbs_conditional.jl 12 0.0%
src/mcmc/Inference.jl 18 77.3%
ext/TuringDynamicHMCExt.jl 29 0.0%
src/mcmc/mh.jl 32 57.43%
ext/TuringOptimExt.jl 50 0.0%
src/variational/advi.jl 53 0.0%
Totals Coverage Status
Change from base Build 11050401755: -29.3%
Covered Lines: 912
Relevant Lines: 1579

💛 - Coveralls

@penelopeysm
Copy link
Member Author

This method ambiguity is fixed in JuliaDiff/ForwardDiff.jl#687, it just needs a release

@penelopeysm
Copy link
Member Author

cf. JuliaDiff/ForwardDiff.jl#712

@penelopeysm
Copy link
Member Author

penelopeysm commented Oct 23, 2024

I think bumping Optimization to v4 (which in turn bumps OptimizationBase to v2) would also allow it to work with Mooncake as an AD backend (since it now goes via DifferentiationInterface, SciML/OptimizationBase.jl#108). Both the MLE and MAP tests pass with Optimization@4 and adtype=AutoMooncake.

@yebai
Copy link
Member

yebai commented Oct 23, 2024

Maybe mark ForwardDiff-related tests as broken and get this merged?

@penelopeysm
Copy link
Member Author

@yebai can do!

@penelopeysm
Copy link
Member Author

penelopeysm commented Oct 23, 2024

It's curious, but the ForwardDiff tests that were failing previously seem to have been fixed on Julia 1.11.

These were the previous failures: https://github.com/TuringLang/Turing.jl/actions/runs/11072371830/job/30766467971 This was pre-1.11 so the CI was running on 1.10.5.

In contrast, none of those tests fail here: https://github.com/TuringLang/Turing.jl/actions/runs/11483911558/job/31960475967 The only failure here is because Mooncake was marked as broken, which it isn't.

The method that was ambiguous was promote_rule, and there were some changes to this recently, https://github.com/JuliaLang/julia/commits/6c70bf784999b478bc176fe594738f9746a1dcfd/base/irrationals.jl so maybe one of them fixed it for us.

@penelopeysm
Copy link
Member Author

penelopeysm commented Oct 24, 2024

The remaining test failure is #2371. I could rerun CI to get the green tick, but don't see much of a point.

@penelopeysm penelopeysm marked this pull request as ready for review October 24, 2024 01:13
@penelopeysm penelopeysm requested a review from mhauru October 24, 2024 01:53
Copy link
Member

@mhauru mhauru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@yebai
Copy link
Member

yebai commented Oct 24, 2024

Feel free to merge.

@penelopeysm penelopeysm merged commit 08331c5 into master Oct 24, 2024
60 of 62 checks passed
@penelopeysm penelopeysm deleted the ch-optimization4 branch October 24, 2024 10:34
@penelopeysm
Copy link
Member Author

CI passed on the main branch after we merged 😄 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants